package com.situ.config;

import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(MinioProperty.class)
@RequiredArgsConstructor
public class MinioConfiguration {

    private final MinioProperty minioProperty;

    @Bean
    public MinioClient minioClient () {
        return MinioClient
                .builder()
                .endpoint(minioProperty.getEndpoint())
                .credentials(minioProperty.getAccessKey(), minioProperty.getSecretKey())
                .build();
    }

}
